<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
class Upload_csv_m extends CI_Model{
    public function uploadImage($dataImage){ //Thuc hien upload anh
            $_FILES['file_upload'] = $dataImage;
            $file_max_size = 2000; // TÃ­nh theo KB
            $folder_upload_in =base_url()."csv_source/"; 
            $file_tmp = isset($_FILES['file_upload']['tmp_name']) ? $_FILES['file_upload']['tmp_name'] : "";
            //$file_tmp = $_FILES['file_upload']['tmp_name'];
            $file_name = isset($_FILES['file_upload']['name']) ? $_FILES['file_upload']['name'] : "";
            //$file_name = $_FILES['file_upload']['name'];
            $file_type = isset($_FILES['file_upload']['type']) ? $_FILES['file_upload']['type'] : "";
            $file_size = isset($_FILES['file_upload']['size']) ? $_FILES['file_upload']['size'] : "";
            $file_error = isset($_FILES['file_upload']['error']) ? $_FILES['file_upload']['error'] : "";
            
            if ( $file_size > ($file_max_size*1024) )
            {
            return false;
            }
            if ( $file_type == "text/plain" )
            {
            return false;
            }
            move_uploaded_file($file_tmp, $folder_upload_in.$file_name);
            //copy( $file_tmp, "./" . $folder_upload_in . $file_name);
           return true;
        }
   

}
?>
